package com.hsjk.szwj.module.official.dal.mysql.unit;

import com.hsjk.szwj.framework.common.pojo.PageResult;
import com.hsjk.szwj.framework.mybatis.core.mapper.BaseMapperX;
import com.hsjk.szwj.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hsjk.szwj.module.official.controller.admin.unit.vo.AdminModuleBannerPageReqVO;
import com.hsjk.szwj.module.official.controller.app.unit.vo.AppModuleBannerPageReqVO;
import com.hsjk.szwj.module.official.dal.dataobject.unit.OfficialWebsiteModuleBannerDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/11/23 23:47
 **/
@Mapper
public interface IOfficialWebsiteModuleBannerMapper extends BaseMapperX<OfficialWebsiteModuleBannerDO> {
    default PageResult<OfficialWebsiteModuleBannerDO> selectAdminPage(AdminModuleBannerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OfficialWebsiteModuleBannerDO>()
                .eqIfPresent(OfficialWebsiteModuleBannerDO::getBannerName, reqVO.getBannerName())
                .eqIfPresent(OfficialWebsiteModuleBannerDO::getBannerType, reqVO.getBannerType())
                .orderByDesc(OfficialWebsiteModuleBannerDO::getCreateTime));
    }

    default PageResult<OfficialWebsiteModuleBannerDO> selectAppPage(AppModuleBannerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OfficialWebsiteModuleBannerDO>()
                .eqIfPresent(OfficialWebsiteModuleBannerDO::getBannerName, reqVO.getBannerName())
                .eqIfPresent(OfficialWebsiteModuleBannerDO::getBannerType, reqVO.getBannerType())
                .orderByDesc(OfficialWebsiteModuleBannerDO::getCreateTime));
    }
}
